package com.config;

import com.github.pagehelper.PageHelper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * 配置分页的数据源
 * @author linyukun
 * @date 2022/7/14 15:42
 */
@Configuration
public class MyBatisConfig {
    @Bean
    public PageHelper pageHelper() {
        PageHelper pageHelper = new PageHelper();
        Properties props = new Properties();
        props.setProperty("dialect", "mysql");
        props.setProperty("offsetAsPageNum", "true");
        props.setProperty("rowBoundsWithCount", "true");
        props.setProperty("reasonable", "false");
        props.setProperty("supportMethodsArguments","true");
        props.setProperty("pageSizeZero","true");

        pageHelper.setProperties(props);

        return pageHelper;
    }
}
